package cn.luischen.controller;

import cn.luischen.service.content.ContentService;
import cn.luischen.constant.Types;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import cn.luischen.service.site.SiteService;
import cn.luischen.utils.TaleUtils;
import cn.luischen.utils.MapCache;
import cn.luischen.dto.cond.ContentCond;
import cn.luischen.service.meta.MetaService;
import cn.luischen.dto.MetaDto;
import cn.luischen.constant.WebConst;
import cn.luischen.model.UserDomain;

import org.powermock.reflect.Whitebox;
import org.mockito.Mock;
import static org.junit.Assert.fail;
import org.junit.runner.RunWith;
import java.util.HashMap;
import java.util.ArrayList;
import org.mockito.MockitoAnnotations;
import com.alibaba.fastjson.JSONArray;
import org.junit.After;
import org.powermock.core.classloader.annotations.PrepareForTest;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import java.lang.reflect.Method;
import org.junit.rules.ExpectedException;
import org.mockito.InjectMocks;
import org.junit.Test;
import static org.junit.Assert.*;
import com.unitspirit.runtime.*;
import org.mockito.Mockito;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import org.junit.Rule;
import static org.junit.Assert.assertNotNull;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.assertTrue;
import com.alibaba.fastjson.parser.ParserConfig;

/**
* The class <code>BaseControllerTest</code> contains tests for the class <code>{@link BaseController}</code>.
* Copyright (c) 2020
* 
* @generatedBy UnitSpirit at 2021-09-07 17:51:29
* @version 1.0.20210903
*/

@PowerMockIgnore({ "javax.management.*" })
public class BaseController_getUid_WGTest {

	@Rule
	public ExpectedException unitspirit_thrown = ExpectedException.none();

	/**
	* 测试方法初始化.
	* 
	* @throws Exception 
	*         if the initialization fails for some reason 
	*  
	* @generatedBy UnitSpirit at 2021-09-07 17:51:29
	*/
	@org.junit.Before
	public void setUp() throws Exception {
		try {
			GlobalUnitInit.init();
			MockitoAnnotations.initMocks(this);
			ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	/**
	* @date 2021-09-07 17:51:30
	* @see cn.luischen.controller.BaseController#getUid
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_getUid_0113_190019_049_1_0() throws Throwable {
		cn.luischen.controller.BaseController unitspirit_fixture = Mockito
				.mock(cn.luischen.controller.BaseController.class);
		javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		String result_expected = "1";

		cn.luischen.model.UserDomain mock_result_UserDomain2 = JSON.parseObject(
				"{\"activated\":0,\"created\":1490756162,\"email\":\"1034683568@qq.com\",\"groupName\":\"visitor\",\"logged\":0,\"password\":\"a66abb5684c45962d887564f08346e8d\",\"screenName\":\"admin1\",\"uid\":1,\"username\":\"admin\"}",
				cn.luischen.model.UserDomain.class);
		PowerMockito.doReturn(mock_result_UserDomain2).when(unitspirit_fixture)
				.user(Mockito.any(javax.servlet.http.HttpServletRequest.class));
		cn.luischen.model.UserDomain mock_sub_caller_UserDomain1 = PowerMockito
				.mock(cn.luischen.model.UserDomain.class);
		Integer mock_result_Integer1 = 1;

		PowerMockito.when(mock_sub_caller_UserDomain1.getUid()).thenReturn(mock_result_Integer1);

		when(unitspirit_fixture.getUid(HttpServletRequest_p_0)).thenCallRealMethod();
		Integer unitspirit_result = unitspirit_fixture.getUid(HttpServletRequest_p_0);
		UnitAssert.assertEquals(result_expected, UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}

	/**
	* @date 2021-09-07 17:51:30
	* @see cn.luischen.controller.BaseController#getUid
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_getUid_0113_190019_049_6_0() throws Throwable {
		cn.luischen.controller.BaseController unitspirit_fixture = Mockito
				.mock(cn.luischen.controller.BaseController.class);
		javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		String result_expected = "1";

		cn.luischen.model.UserDomain mock_result_UserDomain2 = JSON.parseObject(
				"{\"activated\":0,\"created\":1490756162,\"email\":\"1034683568@qq.com\",\"groupName\":\"visitor\",\"logged\":0,\"password\":\"a66abb5684c45962d887564f08346e8d\",\"screenName\":\"admin1\",\"uid\":1,\"username\":\"admin\"}",
				cn.luischen.model.UserDomain.class);
		PowerMockito.doReturn(mock_result_UserDomain2).when(unitspirit_fixture)
				.user(Mockito.any(javax.servlet.http.HttpServletRequest.class));
		cn.luischen.model.UserDomain mock_sub_caller_UserDomain1 = PowerMockito
				.mock(cn.luischen.model.UserDomain.class);
		Integer mock_result_Integer1 = 1;

		PowerMockito.when(mock_sub_caller_UserDomain1.getUid()).thenReturn(mock_result_Integer1);

		when(unitspirit_fixture.getUid(HttpServletRequest_p_0)).thenCallRealMethod();
		Integer unitspirit_result = unitspirit_fixture.getUid(HttpServletRequest_p_0);
		UnitAssert.assertEquals(result_expected, UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}

	/**
	* @date 2021-09-07 17:51:30
	* @see cn.luischen.controller.BaseController#getUid
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_getUid_0113_190031_954_1_0() throws Throwable {
		cn.luischen.controller.BaseController unitspirit_fixture = Mockito
				.mock(cn.luischen.controller.BaseController.class);
		javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		String result_expected = "1";

		cn.luischen.model.UserDomain mock_result_UserDomain2 = JSON.parseObject(
				"{\"activated\":0,\"created\":1490756162,\"email\":\"1034683568@qq.com\",\"groupName\":\"visitor\",\"logged\":0,\"password\":\"a66abb5684c45962d887564f08346e8d\",\"screenName\":\"admin12\",\"uid\":1,\"username\":\"admin\"}",
				cn.luischen.model.UserDomain.class);
		PowerMockito.doReturn(mock_result_UserDomain2).when(unitspirit_fixture)
				.user(Mockito.any(javax.servlet.http.HttpServletRequest.class));
		cn.luischen.model.UserDomain mock_sub_caller_UserDomain1 = PowerMockito
				.mock(cn.luischen.model.UserDomain.class);
		Integer mock_result_Integer1 = 1;

		PowerMockito.when(mock_sub_caller_UserDomain1.getUid()).thenReturn(mock_result_Integer1);

		when(unitspirit_fixture.getUid(HttpServletRequest_p_0)).thenCallRealMethod();
		Integer unitspirit_result = unitspirit_fixture.getUid(HttpServletRequest_p_0);
		UnitAssert.assertEquals(result_expected, UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}

	/**
	* @date 2021-09-07 17:51:30
	* @see cn.luischen.controller.BaseController#getUid
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_getUid_0113_190031_954_5_0() throws Throwable {
		cn.luischen.controller.BaseController unitspirit_fixture = Mockito
				.mock(cn.luischen.controller.BaseController.class);
		javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		String result_expected = "1";

		cn.luischen.model.UserDomain mock_result_UserDomain2 = JSON.parseObject(
				"{\"activated\":0,\"created\":1490756162,\"email\":\"1034683568@qq.com\",\"groupName\":\"visitor\",\"logged\":0,\"password\":\"a66abb5684c45962d887564f08346e8d\",\"screenName\":\"admin12\",\"uid\":1,\"username\":\"admin\"}",
				cn.luischen.model.UserDomain.class);
		PowerMockito.doReturn(mock_result_UserDomain2).when(unitspirit_fixture)
				.user(Mockito.any(javax.servlet.http.HttpServletRequest.class));
		cn.luischen.model.UserDomain mock_sub_caller_UserDomain1 = PowerMockito
				.mock(cn.luischen.model.UserDomain.class);
		Integer mock_result_Integer1 = 1;

		PowerMockito.when(mock_sub_caller_UserDomain1.getUid()).thenReturn(mock_result_Integer1);

		when(unitspirit_fixture.getUid(HttpServletRequest_p_0)).thenCallRealMethod();
		Integer unitspirit_result = unitspirit_fixture.getUid(HttpServletRequest_p_0);
		UnitAssert.assertEquals(result_expected, UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}

	/**
	* @date 2021-09-07 17:51:30
	* @see cn.luischen.controller.BaseController#getUid
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_getUid_1126_111348_147_1_0() throws Throwable {
		cn.luischen.controller.BaseController unitspirit_fixture = Mockito
				.mock(cn.luischen.controller.BaseController.class);
		javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		String result_expected = "1";

		cn.luischen.model.UserDomain mock_result_UserDomain1 = JSON.parseObject(
				"{\"activated\":0,\"created\":1490756162,\"email\":\"1034683568@qq.com\",\"groupName\":\"visitor\",\"logged\":0,\"password\":\"a66abb5684c45962d887564f08346e8d\",\"screenName\":\"admin\",\"uid\":1,\"username\":\"admin\"}",
				cn.luischen.model.UserDomain.class);
		PowerMockito.doReturn(mock_result_UserDomain1).when(unitspirit_fixture).user(Mockito.any());

		when(unitspirit_fixture.getUid(HttpServletRequest_p_0)).thenCallRealMethod();
		Integer unitspirit_result = unitspirit_fixture.getUid(HttpServletRequest_p_0);
		UnitAssert.assertEquals(result_expected, UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}

	/**
	* @date 2021-09-07 17:51:30
	* @see cn.luischen.controller.BaseController#getUid
	* @category auto generate by UnitSpirit  
	* @author UnitSpirit   
	*/
	@Test
	public void test_getUid_1126_124407_210_1_0() throws Throwable {
		cn.luischen.controller.BaseController unitspirit_fixture = Mockito
				.mock(cn.luischen.controller.BaseController.class);
		javax.servlet.http.HttpServletRequest HttpServletRequest_p_0 = Mockito
				.mock(javax.servlet.http.HttpServletRequest.class);
		//成员变量设置

		//返回值定义 
		String result_expected = "1";

		cn.luischen.model.UserDomain mock_result_UserDomain1 = JSON.parseObject(
				"{\"activated\":0,\"created\":1490756162,\"email\":\"1034683568@qq.com\",\"groupName\":\"visitor\",\"logged\":0,\"password\":\"a66abb5684c45962d887564f08346e8d\",\"screenName\":\"admin11\",\"uid\":1,\"username\":\"admin\"}",
				cn.luischen.model.UserDomain.class);
		PowerMockito.doReturn(mock_result_UserDomain1).when(unitspirit_fixture).user(Mockito.any());

		when(unitspirit_fixture.getUid(HttpServletRequest_p_0)).thenCallRealMethod();
		Integer unitspirit_result = unitspirit_fixture.getUid(HttpServletRequest_p_0);
		UnitAssert.assertEquals(result_expected, UnitSpiritFastJsonUtil.getJsonString2(unitspirit_result));
	}
}
